
#Charles S. Bullock, III, William D. Hicks, 
#M.V. Hood, III, Seth C. McKee, and Daniel A. Smith
#"The Election of African American State Legislators in the Modern South" in LSQ

#THIS FILE REPRODUCES FIGURE 1 IN MANUSCRIPT

rm(list=ls())


#SET A WORKING DIRECTORY TO SAVE FIGURE
setwd("[MAKE DIRECATORY HERE]")

#LOAD DATASET FIGURE_1_A1.Rdata
load("~[FILE PATH]/FIGURE_1_A1.Rdata")


dt2$perblack <- round(dt2$black/dt2$seats, 2)
dt2$pergop <- round(dt2$gop/dt2$seats, 2)


dt2$year <- dt2$v05
dt2$year[dt2$v05 %in% c(1969,1971,1973,1975,1977,1979,1981,1983,1985,1987,1989,1991,1993,1995,1997,1999,
                        2001,2003,2005,2007,2009,2011,2013)] <- dt2$year[dt2$v05 %in% c(1969,1971,1973,1975,1977,1979,
                                                                                        1981,1983,1985,1987,1989,1991,1993,1995,1997,1999,
                                                                                        2001,2003,2005,2007,2009,2011,2013)] + 1

tbl <- aggregate(dt2$perblack, by=list(dt2$year), mean)
tbl <- tbl[-25,]

png('FIGURE_1.png', width=900, height=700, pointsize=16)
plot(tbl$x, type='o', cex.main=1.5, pch=15, ylim=c(0,.25), cex=2, lwd=2, lty=1, cex.lab=6, axes=FALSE, xlab="", ylab="")
axis(1, at=c(1:24), labels=tbl$Group.1, cex=.75)
axis(2, pos= c(.5,75), at=c(0,.1,.2,.25), labels=c('0%','10%','20%','25%'))

dev.off()
     

